//
//  ByDocumentaryUserTitleCell.m
//  caipiao_ios
//
//  Created by mc on 2018/8/10.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByDocumentaryUserTitleCell.h"

@implementation ByDocumentaryUserTitleCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByDocumentaryUserTitleCell";
    ByDocumentaryUserTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.contentView.backgroundColor = BY_BACKGROUND_COLOR;
        [self initViews];
    }
    return self;
}


- (void)initViews{
    
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 180)];
    redView.backgroundColor = BY_THEME_COLOR;
    [self.contentView addSubview:redView];
    
    UIView *backgroundView = [[UIView alloc] init];
    [self.contentView addSubview:backgroundView];
    [backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(8);
        make.right.equalTo(self.contentView).offset(-8);
        make.bottom.equalTo(self.contentView).offset(-10);
        make.height.mas_equalTo(@220);
    }];
    backgroundView.backgroundColor = [UIColor whiteColor];
    backgroundView.layer.cornerRadius = 5;
    
    
    UIImageView *iconView = [[UIImageView alloc] init];
    [self.contentView addSubview:iconView];
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(backgroundView.mas_top).offset(10);
        make.centerX.equalTo(self.contentView).offset(0);
        make.size.mas_equalTo(CGSizeMake(60, 60));
    }];
    iconView.backgroundColor = BY_Blue_COLOR;
    iconView.layer.cornerRadius = 30;
    
    UILabel *nickLabel = [[UILabel alloc] init];
    [backgroundView addSubview:nickLabel];
    [nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(10);
        make.top.equalTo(iconView.mas_bottom).offset(5);
        make.right.equalTo(backgroundView).offset(-10);
        make.height.mas_equalTo(@15);
    }];
    nickLabel.text = @"翻滚的咸鱼";
    nickLabel.textColor = [UIColor blackColor];
    nickLabel.font = FONT(14);
    nickLabel.textAlignment =  NSTextAlignmentCenter;
    
    UILabel *numberLabel = [[UILabel alloc] init];
    [backgroundView addSubview:numberLabel];
    [numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(10);
        make.top.equalTo(nickLabel.mas_bottom).offset(10);
        make.right.equalTo(backgroundView).offset(-10);
        make.height.mas_equalTo(@15);
    }];
    numberLabel.text = @"粉丝:5894";
    numberLabel.textColor = [UIColor lightGrayColor];
    numberLabel.font = FONT(12);
    numberLabel.textAlignment =  NSTextAlignmentCenter;
    
    
    UIView *brownView = [[UIView alloc] init];
    [backgroundView addSubview:brownView];
    [brownView  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(13);
        make.right.equalTo(backgroundView).offset(-13);
        make.top.equalTo(numberLabel.mas_bottom).offset(8);
        make.height.mas_equalTo(@20);
    }];
    brownView.backgroundColor = rgba(255, 242, 228, 1);
    
    //zhanji战绩
    UIImageView *recordView = [[UIImageView alloc] init];
    [backgroundView addSubview:recordView];
    [recordView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(13);
        make.top.equalTo(brownView.mas_bottom).offset(11);
        make.size.mas_equalTo(CGSizeMake(89, 47));
    }];
    recordView.image = [UIImage imageNamed:@"zhanji战绩"];
    
    UILabel *line = [[UILabel alloc] init];
    [backgroundView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(backgroundView).offset(-45);
        make.left.equalTo(backgroundView).offset(15);
        make.right.equalTo(backgroundView).offset(-15);
        make.height.mas_equalTo(@1);
    }];
    line.backgroundColor = BY_LINE_COLOR;
    
    
    
    UILabel *titleLabel = [[UILabel alloc] init];
    [backgroundView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backgroundView).offset(18);
        make.bottom.equalTo(backgroundView).offset(-18);
        make.height.mas_equalTo(@15);
        make.width.mas_equalTo(@70);
    }];
    titleLabel.font = FONT(14);
    titleLabel.textColor = BY_TEXT_COLOR;
    titleLabel.text = @"近5期状态";
    
    
    

}
@end
